@extends('home.layout.base')
@section('title', '个人中心')
@section('pluginstyle')
<script src="{{ asset('/dist/home/js/1102.js') }}"></script>
<link rel="stylesheet" href="{{ asset('/dist/home/css/qikoo_user.css') }}">
<script>var _isindex = 0;</script>
@endsection
@section('content')
<div class="user-body">
    <div class="user-container">
        <div class="user-crumbs m-b-10">
            <a href="#">首页</a> > 我的订单
        </div>
        <div class="clearfix_new">
            @include('home.user.menu')
            <div class="user-main">
                <div class="order-main clearfix_new">
                    <h1 style="border:0">我的订单 <a href="#" data-monitor="user_myorder_consult" onclick="NTKF.im_openInPageChat()" class="inline-kefu"></a></h1>
                    <div class="mod-user-list">
                        <ul id="ul_order_type" class="order_type" style="margin-bottom:20px;padding:0 0 0 10px">
                            <li data-order_type="-1" _class="cur" data-status="-1"><a data-monitor="user_myorder_allstatus" class="order_type_title" data-href="/user/myorder/?status=-1">全部订单<span style="display:none" class="order_type_count">1</span></a></li>
                            <li data-order_type="0" _class="disable" data-status="0"><a data-monitor="user_myorder_waitpay" class="order_type_title" data-href="/user/myorder/?status=0">待付款<span class="order_type_count">0</span></a></li>
                            <li data-order_type="1" _class="disable" data-status="1"><a data-monitor="user_myorder_waitgoods" class="order_type_title" data-href="/user/myorder/?status=1">待发货<span class="order_type_count">0</span></a></li>
                            <li data-order_type="2" _class="enable" data-status="3"><a data-monitor="user_myorder_getgoods" class="order_type_title" data-href="/user/myorder/?status=3">已发货<span class="order_type_count">0</span></a></li>
                            <li data-order_type="3" _class="enable" data-status="4"><a data-monitor="user_myorder_allover" class="order_type_title" data-href="/user/myorder/?status=4">已完成<span class="order_type_count">0</span></a></li>
                            <li data-order_type="4" _class="enable" data-status="2"><a data-monitor="" class="order_type_title" data-href="/user/myorder/?status=2">已取消<span class="order_type_count">0</span></a></li>
                        </ul>
                        <table style="" width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tbody>
                                <tr class="list-title">
                                    <th class="list-col1">
                                        订单信息
                                    </th>
                                    <th class="list-col2">
                                        订单金额
                                    </th>
                                    <th class="list-col3">
                                        订单状态
                                    </th>
                                    <th class="list-col4">
                                        操作
                                    </th>
                            <tbody>
                                <tr>
                                    <td style="line-height:170px;text-align:center" colspan="4">
                                        暂无订单
                                    </td>
                                </tr>
                            </tbody>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div id="countdown_tip" class="dialog_wrap">
                    <div class="xiasanjiao">
                        ▼
                    </div>
                    <div class="dialog_content">
                        <p style="width:180px">
                            请您尽快完成付款，否则您提交的订单会自动取消！
                        </p>
                    </div>
                </div>
                <div id="wuliu" class="wuliu_wrap" style="left:100px;top:100px;z-index:100">
                    <div class="shangsanjiao">
                        ▲
                    </div>
                    <div class="dialog_content">
                        <p style="border-bottom:1px solid #ececec;color:#666;font-weight:700;height:40px;line-height:40px;width:375px">
                            <span style="display:inline-block;margin-left:35px">处理时间</span><span style="display:inline-block;margin-left:150px">订单信息</span>
                        </p>
                        <p class="loading">
                            数据加载中...
                        </p>
                        <ul class="order_info_ul">
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
@section('pluginscript')
<!--[if lte IE 6]>
<script src="../dist/home/js/dd_belatedpng_0.0.8a.js"></script>
<script>DD_belatedPNG.fix("div, ul, img, li, input, a, span, i")</script>
<![endif]-->
<script>$(function() {
        var i = $("#ul_order_type.order_type li");
        i.removeClass("cur,disable,enable");
        var t = "{% int($smarty.get.status)%}";
        i.each(function() {
            "" == t && (t = -1);
            var i = parseInt($(this).find("span.order_type_count").html());
            if (i > 0) {
                $(this).addClass("enable");
                var e = $(this).find("a");
                $(e).attr("href", $(e).data("href")), 0 == $(this).attr("data-order_type") && $(this).find(".order_type_count").css("color", "#ff7800"), 3 == $(this).attr("data-order_type") && $(this).find(".order_type_count").css("color", "#82c92f")
            } else
                0 == i && $(this).addClass("disable");
            t == $(this).data("status") && ($(this).removeClass("cur,disable,enable"), $(this).addClass("cur"))
        })
    }), $(function() {
        var i = 0, t = 1e3, e = null;
        $("body").mouseover(function(i) {
            e = i.target
        }), $(".order_info_click").each(function() {
            $(this).click(function() {
                var o = this;
                $("#wuliu").css({left: $(o).position().left - 360, top: $(o).position().top + 30}).show(), $("#wuliu .order_info_ul").hide(), $("#wuliu .loading").show(), $.getJSON("/user/orderhis", {id: $(o).data("id")}).done(function(a) {
                    $("#wuliu .order_info_ul").html("");
                    for (var n = "", s = 0; s < a.data.length; s++)
                        n += '<li><div class="order_info_time">' + a.data[s].acceptTime + '</div><div class="order_info_text">' + a.data[s].acceptAddress + "</div></li>";
                    $("#wuliu .order_info_ul").show().html(n), $("#wuliu .loading").hide(), $("#wuliu").css({left: $(o).position().left - 360, top: $(o).position().top + 30}).show(), $(".order_info_click").unbind("mouseleave"), $(o).mouseleave(function() {
                        clearTimeout(i), i = setTimeout(function() {
                            $("#wuliu").find(e).length > 0 ? ($("#wuliu").unbind("mouseleave"), $("#wuliu").mouseleave(function() {
                                i = setTimeout(function() {
                                    $("#wuliu").hide()
                                }, t)
                            })) : $("#wuliu").hide()
                        }, t)
                    })
                })
            })
        })
    }), $(function() {
        $(".countdonw_time").each(function() {
            var i = this;
            Timer({milliseconds: $(this).data("countdown_time"), interval: 500, immediately: !0, callback: function(t, e) {
                    $(i).html(e.hours + "时" + e.minutes + "分" + e.second + "秒")
                }, fnEnd: function() {
                    $(i).addClass("countdonw_time_disable"), $(".fukuan_info").hide()
                }}).run()
        })
    }), $(function() {
        $(".fukuan_info").hover(function() {
            var i = this;
            $("#countdown_tip").css({left: $(i).position().left - 100, top: $(i).position().top - 70}).show()
        }, function() {
            $("#countdown_tip").hide()
        })
    }), $(".console-cancel").click(function() {
        var i = $(this);
        1 == i.attr("data-paied") ? paiedDialog(i.attr("data-id")) : qikoo.popConfirm(i, "您确定取消本订单吗？", function() {
            $.post("/user/cancelmyorder?id=" + i.attr("data-id") + "&token=4cf42b72a7e525885f2fdbd8e4e63f9c", function(i) {
                0 == i.result ? qikoo.dialog.alert("取消订单失败:" + i.msg) : window.location.reload()
            }, "json")
        })
    });
    var paiedDialog = function(i) {
        var t = ['<div class="dialog-content">', '<div class="dialog-paied-cancel">', '<div class="cancel-reason">', "<b>取消原因：</b>", '<div class="select-input">', '<b id="reportCategory">请选择</b>', '<svg><path fill="transparent" stroke="#fff" stroke-width="2" d="M4,8L10,14L16,8"></path></svg>', '<div class="select-list">', '<a class="select-item" data-id="现在不想购买">现在不想购买</a>', '<a class="select-item" data-id="收货人信息有误">收货人信息有误</a>', '<a class="select-item" data-id="发票信息有误">发票信息有误</a>', '<a class="select-item" data-id="重复下单">重复下单</a>', '<a class="select-item" data-id="发货时间过长">发货时间过长</a>', '<a class="select-item" data-id="其它原因">其它原因</a>', "</div>", "</div>", '<div class="errtip">请填写取消原因</div>', "</div>", "<p>温馨提示：</p>", "<p>· 订单成功取消后无法恢复</p>", "<p>· 该订单已付金额将按您支付方式原路返还到您的账户</p>", "</div>", "</div>", '<div class="dialog-console clearfix_new">', '<a class="console-btn-confirm" href="#" onclick="return false;">确定取消</a>', '<a class="console-btn-cancel" href="#" onclick="return false;">暂不取消</a>', "</div>"].join(""), e = qikoo.dialog.show({html: t, title: "取消订单", width: 530});
        e.find(".select-input").click(function(i) {
            var t = $(i.target);
            t.hasClass("select-item") ? ($(this).find("b").html(t.text()), $(this).find(".select-item").removeClass("item-curr"), t.addClass("item-curr")) : setTimeout(function() {
                $(".select-list").show()
            }, 100)
        });
        var o = !1;
        e.find(".console-btn-confirm").click(function() {
            if (!o) {
                var t = e.find(".item-curr").text();
                t ? (o = !0, $.post("/user/cancelmypayedorder", {id: i, token: "4cf42b72a7e525885f2fdbd8e4e63f9c", reason: t}, function(i) {
                    o = !1, 0 == i.errno ? window.location.reload() : qikoo.dialog.alert(i.errmsg)
                }, "json")) : (e.find(".errtip").show(), e.find(".select-input").addClass("select-error").on("click", function() {
                    $(this).removeClass("select-error"), e.find(".errtip").hide()
                }))
            }
        }), e.find(".console-btn-cancel").click(function() {
            qikoo.dialog.hide()
        }), $("body").click(function() {
            $(".select-list").hide()
        })
    };
    $(".item-comfirm-packet").click(function() {
        var i = $(this).attr("data-id");
        qikoo.dialog.confirm("如您已收到货物，请点击确定按钮。", function() {
            $.post("/user/finishmyorder", {id: i, token: "4cf42b72a7e525885f2fdbd8e4e63f9c"}, function(i) {
                i && 0 == i.errno ? location.reload() : qikoo.dialog.alert(i.errmsg)
            }, "json")
        })
    });</script>
<script src="../dist/home/js/ntkfstat.js" charset="utf-8"></script>
@endsection